<!--
*Author：jxx
 *Contact：283591387@qq.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/system/workbusiness/upper_workpiece.js此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/system/workbusiness/upper_workpiece.js";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'id',
                footer: "Foots",
                cnName: '工件',
                name: 'workbusiness/upper_workpiece',
                url: "/upper_workpiece/",
                sortName: "id"
            });
            const editFormFields = ref({"workpiece_name":"","workpiece_type":"","machine":"","workpiece_length":"","workpiece_width":"","workpiece_height":"","material":"","target_accuracy":"","x_instance":"","y_instance":"","z_instance":""});
            const editFormOptions = ref([
                              [{"title":"模具名称","field":"workpiece_name","type":"text"},
                               {"title":"工件型号","field":"workpiece_type","type":"text"},
                               {"dataKey":"机床","data":[],"title":"加工机床","required":true,"field":"machine","type":"select"}],
                              [{"title":"工件长度","field":"workpiece_length","type":"text"},
                               {"title":"工件宽度","field":"workpiece_width","type":"text"},
                               {"title":"工件高度","field":"workpiece_height","type":"text"}],
                              [{"title":"材质","field":"material","type":"text"},
                               {"title":"目标精度","field":"target_accuracy","type":"number"}],
                              [{"title":"预设x距离","required":true,"field":"x_instance",'min':'-1000000000' ,"type":"number"},
                               {"title":"预设y距离","required":true,"field":"y_instance","type":"number"},
                               {"title":"预设z距离","required":true,"field":"z_instance","type":"number"}
                            ],
                               [{"title":"预设中心点","field":"ceshi","type":"canvas"}]
                            ]);
            const searchFormFields = ref({});
            const searchFormOptions = ref([]);
            const columns = ref([{field:'id',title:'id',type:'int',width:110,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'workpiece_name',title:'模具名称',type:'string',width:220,align:'left',sort:true},
                       
                       {field:'workpiece_length',title:'工件长度',type:'decimal',width:110,align:'left'},
                       {field:'workpiece_width',title:'工件宽度',type:'decimal',width:110,align:'left'},
                       {field:'workpiece_height',title:'工件高度',type:'decimal',width:110,align:'left'},
                       {field:'is_delete',title:'is_delete',type:'bool',width:110,hidden:true,readonly:true,align:'left'},
                       {field:'machine',title:'加工机床',type:'int',bind:{ key:'机床',data:[]},width:120,require:true,align:'left'},
                   
                       {field:'x_instance',title:'预设中心点x距离',type:'decimal',width:120,require:true,align:'left'},
                       {field:'y_instance',title:'预设中心点y距离',type:'decimal',width:120,require:true,align:'left'},
                       {field:'z_instance',title:'预设中心点z距离',type:'decimal',width:120,require:true,align:'left'},

                       {field:'workpiece_type',title:'工件型号',type:'string',width:220,align:'left'},
                       {field:'material',title:'材质',type:'string',width:120,align:'left'},
                       {field:'target_accuracy',title:'目标精度',type:'decimal',width:120,align:'left'},
                    
                    
                    ]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
